const range = document.getElementById('range')
const label = document.getElementById('label')
setLabel()
function setLabel() {
    range.addEventListener('input', (e) => {
        // label.style.left = e.target.value + '%'
        label.style.left = `${scale(e.target.value, 0, 100, 3, 97)}%`
        label.innerText = e.target.value
    })
}
// https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers
const scale = (num, in_min, in_max, out_min, out_max) => {
    return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}